
//Modified on 14-12-11
#pragma once

#include "ifcppgeometry/ExtrusionDetector/ExtrusionDetector.h"

class CGeomTreeNode;

struct GeomMeshIOUtil
{
	static void	ExportNodeMeshesSimply( const char* fileName, const vector<vector<carve::geom::vector<3> > >& vvNodePts, const vector<vector<carve::geom::vector<3> > >& vvNormals, 
									const vector<vector<int> >& vvTriIdx );

	static void ExportNodeMeshSimply( fstream& expFile, const vector<carve::geom::vector<3> >& vNodePt, const vector<carve::geom::vector<3> >& vNormalT, 
		const vector<int>& vTriIdx );

	// Export Data After Extrusion Detection 
	static void	ExportNodeMeshesWithExtrusionDetected( const char* fileName,  const vector<vector<carve::geom::vector<3> > >& vvVertices, const vector<vector<carve::geom::vector<3> > >& vvNormals, 
		const vector<vector<int> >& vvTriIdx, bool bIsHorizonScope = true );

	static void	ExportNodeMeshAfterExtrusionDetected( fstream& expFile, const vector<PT3D>& vPtUnique, const vector<int>& vTri, const vector<vector<int>>& vvPolygon, 
		const VT3D& norExtrusion, double dDis );

	static void	SaveExportedFileName( const char* filename, const vector<string>& vFileName );


	static void ExportMeshesInNodeMap( const char* exportDir, const char* nodeflag, const map<long long,shared_ptr<CGeomTreeNode>>& mapNodes, vector<string>& vFileExported, bool bIsHorizonScope  = true );

	static void ExportMeshesInNodeVector( const char* exportDir, const char* nodeflag, const vector<shared_ptr<CGeomTreeNode>>& vNodes, vector<string>& vFileExported, bool bIsHorizonScope  = true );

private:
	static void	SortSimplyMeshByNormal( const vector<carve::geom::vector<3> >& vNormal, const vector<int>& vTriIdx, vector<VT3D>& vNorUnique, vector<vector<int>>& vvTriGroup );
};